In [1]:
from konfoo import Index, Byteorder, Double
Item type of the field
class.
In [2]:
Double.item_type
Out[2]:
Checks if the field
class is a bit
field.
In [3]:
Double.is_bit()
Out[3]:
Checks if the field
class is a boolean
field.
In [4]:
Double.is_bool()
Out[4]:
Checks if the field
class is a decimal
number field.
In [5]:
Double.is_decimal()
Out[5]:
Checks if the field
class is a floating point
number field.
In [6]:
Double.is_float()
Out[6]:
Checks if the field
class is a pointer
field.
In [7]:
Double.is_pointer()
Out[7]:
Checks if the field
class is a stream
field.
In [8]:
Double.is_stream()
Out[8]:
Checks if the field
class is a string
field.
In [9]:
Double.is_string()
Out[9]:
In [10]:
double = Double(byte_order='auto')
In [11]:
double = Double()
In [12]:
double
Out[12]:
In [13]:
str(double)
Out[13]:
In [14]:
repr(double)
Out[14]:
In [15]:
double.name
Out[15]:
In [16]:
double.index
Out[16]:
Byte index
of the field
within the byte stream
.
In [17]:
double.index.byte
Out[17]:
Bit offset relative to the byte index
of the field
within the byte stream
.
In [18]:
double.index.bit
Out[18]:
Absolute address of the field
within the data source
.
In [19]:
double.index.address
Out[19]:
Base address of the byte stream
within the data source
.
In [20]:
double.index.base_address
Out[20]:
Indexes the field
and returns the index
after the field
.
In [21]:
double.index_field(index=Index())
Out[21]:
In [22]:
double.alignment
Out[22]:
Byte size of the field group
which the field
is aligned to.
In [23]:
double.alignment.byte_size
Out[23]:
Bit offset of the field
within its aligned field group
.
In [24]:
double.alignment.bit_offset
Out[24]:
In [25]:
double.bit_size
Out[25]:
In [26]:
double.byte_order
Out[26]:
In [27]:
double.byte_order.value
Out[27]:
In [28]:
double.byte_order.name
Out[28]:
In [29]:
double.byte_order = 'auto'
In [30]:
double.byte_order = Byteorder.auto
Maximal float field
value.
In [31]:
double.max()
Out[31]:
Minimal float field
value.
In [32]:
double.min()
Out[32]:
Smallest float field
value.
In [33]:
double.smallest()
Out[33]:
Epsilon float field
value.
In [34]:
double.epsilon()
Out[34]:
Returns the float field
value as a single precision floating point number.
In [35]:
double.value
Out[35]:
Returns the float field
value aligned to its field group
as a number of bytes.
In [36]:
bytes(double)
Out[36]:
In [37]:
bytes(double).hex()
Out[37]:
Returns the float field
value as an integer number.
In [38]:
int(double)
Out[38]:
Returns the float field
value as a single precision floating point number.
In [39]:
float(double)
Out[39]:
Returns the float field
value as a boolean value.
In [40]:
bool(double)
Out[40]:
Returns the meatadata
of the field
as an ordered dictionary.
In [41]:
double.describe()
Out[41]:
In [42]:
double.deserialize(bytes.fromhex('000000000000f03f'), byte_order='little')
Out[42]:
In [43]:
double.value
Out[43]:
In [44]:
bytes(double)
Out[44]:
In [45]:
bytes(double).hex()
Out[45]:
In [46]:
int(double)
Out[46]:
In [47]:
float(double)
Out[47]:
In [48]:
bool(double)
Out[48]:
In [49]:
buffer = bytearray()
In [50]:
double.value = 1
In [51]:
double.value = 1.0
In [52]:
double.value = 0x1
In [53]:
double.value = 0b1
In [54]:
double.value = 0o1
In [55]:
double.value = True
In [56]:
double.value = 1.0
In [57]:
double.serialize(buffer, byte_order='little')
Out[57]:
In [58]:
buffer.hex()
Out[58]:
In [59]:
bytes(double).hex()
Out[59]:
In [ ]: